package o;

import com.huawei.appgallery.appcomment.impl.bean.GetCommentResBean.AppCommentInfo;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.Map;
import o.bdm.e;

public abstract class bdo {
    private static Map<String, SoftReference<bde>> ॱ = new HashMap();

    public enum d {
        COMMENT_APPROVE,
        COMMENT_PUBLISH,
        COMMENT_REPLY
    }

    public static void ˎ(e eVar, AppCommentInfo appCommentInfo) {
        int i = 0;
        int ॱˊ = appCommentInfo.ॱˊ() + eVar.ˋ();
        if (ॱˊ < 0) {
            ॱˊ = 0;
        }
        appCommentInfo.ˏ(ॱˊ);
        ॱˊ = appCommentInfo.ॱˋ() + eVar.ʻ();
        if (ॱˊ >= 0) {
            i = ॱˊ;
        }
        appCommentInfo.ˊ(i);
        appCommentInfo.ˋ(eVar.ॱॱ());
        appCommentInfo.ॱ(eVar.ᐝ());
    }

    public static void ˋ(e eVar, AppCommentInfo appCommentInfo) {
        appCommentInfo.ˎ(eVar.ˊ());
    }

    public static synchronized boolean ˋ(d dVar, String str) {
        boolean z = false;
        synchronized (bdo.class) {
            String ˋ = cev.ˋ(UserSession.getInstance().getUserId());
            if (ˋ != null) {
                String str2 = ˋ + dVar;
                SoftReference softReference = (SoftReference) ॱ.get(str2);
                bde o_bde = null;
                if (softReference != null) {
                    o_bde = (bde) softReference.get();
                }
                if (o_bde == null) {
                    bde o_bde2 = new bde();
                    SoftReference softReference2 = new SoftReference(o_bde2);
                    o_bde2.ˋ = System.currentTimeMillis();
                    o_bde2.ॱ = str;
                    ॱ.put(str2, softReference2);
                } else {
                    boolean z2;
                    if (dVar == d.COMMENT_PUBLISH || dVar == d.COMMENT_REPLY) {
                        long currentTimeMillis = System.currentTimeMillis();
                        if (currentTimeMillis - o_bde.ˋ < 10000) {
                            z2 = true;
                        } else if (currentTimeMillis - o_bde.ˋ >= 20000 || o_bde.ॱ == null || !o_bde.ॱ.equals(str)) {
                            z2 = false;
                        } else {
                            z2 = true;
                        }
                        if (!z2) {
                            o_bde.ˋ = currentTimeMillis;
                            o_bde.ॱ = str;
                        }
                    } else {
                        z2 = false;
                    }
                    z = z2;
                }
            }
        }
        return z;
    }
}
